package com.ztranscript.service;

import java.util.Objects;

import com.spring.BeanPostProcessor;
import com.spring.Component;

/**
 * @author ztranscript 2021/9/18 14:47
 **/
@Component
public class ZtranscriptBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws Exception {
        if (Objects.equals("world", beanName)) {
            System.out.println(beanName);
            System.out.println("初始化前");
        }
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws Exception {
        if (Objects.equals("world", beanName)) {
            System.out.println("初始化后");
            System.out.println("AOP 可以在这一步实现");
        }
        return bean;
    }
}
